package com.trainfinder.ripper.sweep;

import java.util.Calendar;
import java.util.Date;

import com.trainfinder.ripper.Storer;

public class FullSweep implements Sweep {

	 

	public void sweep(String fromStation, String toStation) {
		
		final Storer storer = new Storer();
		final Calendar c = Calendar.getInstance();
	 
// 	c.set(Calendar.MONTH, Calendar.JULY);
// 	c.set(Calendar.DAY_OF_MONTH, 21);
//		
		storer.removeExpiredData();
		int i = 0;
		while (i < 90) {

			storer.dailyStore(c, 1, fromStation, toStation);
			storer.dailyStore(c, 7, fromStation, toStation);

			c.add(Calendar.DAY_OF_YEAR, 1);
			i++;
		}

		// remove anything older than 1 days
		final Date date = new Date(new Date().getTime()-(1000L*24*60*60*1));
	 	storer.removeDataWithOldLastUpdatedTime(fromStation, toStation, date);
	  
	}
	
	
	public static void main (String[] args) {
 
		new FullSweep().sweep("london", "paris");
    } 
}
